package com.cl.spark.udf;

import com.cl.spark.util.AddressUtil;
import com.cl.spark.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.spark.sql.api.java.UDF1;

// 定义 UDF 类
@Slf4j
public class ExtractChineseAndAlphanumericUDF implements UDF1<String, String> {
    @Override
    public String call(String value) {
        try {
            if (value == null) {
                return "null";
            }
            return StringUtil.extractChineseAndAlphanumeric(value);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            return "error";
        }
    }
}
